package cn.wolfcode.crm.service.impl;

import cn.wolfcode.crm.domain.ClientTrace;
import cn.wolfcode.crm.mapper.ClientTraceMapper;
import cn.wolfcode.crm.query.QueryObject;
import cn.wolfcode.crm.service.IClientTraceService;
import cn.wolfcode.crm.util.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ClientTraceServiceImpl implements IClientTraceService {
    @Autowired
    private ClientTraceMapper clientTraceMapper;

    @Override
    public void deleteByPrimaryKey(Long id) {
        clientTraceMapper.deleteByPrimaryKey(id);
    }

    @Override
    public void insert(ClientTrace entity) {
        clientTraceMapper.insert(entity);
    }

    @Override
    public ClientTrace selectByPrimaryKey(Long id) {

        return clientTraceMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<ClientTrace> selectAll() {
        return clientTraceMapper.selectAll();
    }

    @Override
    public void updateByPrimaryKey(ClientTrace entity) {
        clientTraceMapper.updateByPrimaryKey(entity);
    }

    @Override
    public PageResult query(QueryObject qo) {
        Integer total = clientTraceMapper.query4Count(qo);
        if (total == 0) {
            return PageResult.PAGERESULT_EMPTY;
        }
        return new PageResult(total, clientTraceMapper.query4List(qo));
    }
}
